<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
  <head>
    <title>客户关系管理系统</title>
  </head>
  <body>
    <h1>欢迎${LOGINUSER.user_name}访问客户关系管理系统！</h1>
    <hr/>
    <h2>客户信息表</h2>  <a href="custadd">添加客户信息</a>
    <form action="customer" method="post">
      客户名称<input type="text" name="cust_name" value="${cust_name}">
      客户来源<select name="cust_source">
      <option value="">---请选择---</option>
      <c:forEach items="${list1}" var="a">
        <option value="${a.dict_id}" <c:if test="${cust_source==a.dict_id}">selected</c:if> >${a.dict_item_name}</option>
      </c:forEach>
    </select>

      所属行业<select name="cust_industry">
      <option value="">---请选择---</option>
      <c:forEach items="${list2}" var="a">
        <option value="${a.dict_id}" <c:if test="${cust_industry==a.dict_id}">selected</c:if> >${a.dict_item_name}</option>
      </c:forEach>
    </select>

      客户级别<select name="cust_level">
      <option value="">---请选择---</option>
      <c:forEach items="${list3}" var="a">
        <option value="${a.dict_id}" <c:if test="${cust_level==a.dict_id}">selected</c:if> >${a.dict_item_name}</option>
      </c:forEach>
    </select>
  <input type="submit" value="查询">
    </form>
    <table border="1" width="100%">
      <tr>
        <th>编号</th>
        <th>客户名称</th>
        <th>客户来源</th>
        <th>客户所属行业</th>
        <th>客户级别</th>
        <th>固定电话</th>
        <th>手机</th>
        <th>操作</th>
      </tr>
      <c:forEach items="${list}" var="cust">
        <tr>
          <td>${cust.cust_id}</td>
          <td>${cust.cust_name}</td>
          <td>
             <c:forEach items="${list1}" var="a">
               <c:if test="${cust.cust_source==a.dict_id}">${a.dict_item_name}</c:if>
             </c:forEach>
          </td>
          <td>
            <c:forEach items="${list2}" var="a">
              <c:if test="${cust.cust_industry==a.dict_id}">${a.dict_item_name}</c:if>
            </c:forEach>
          </td>
          <td>
            <c:forEach items="${list3}" var="a">
              <c:if test="${cust.cust_level==a.dict_id}">${a.dict_item_name}</c:if>
            </c:forEach>
          </td>
          <td>${cust.cust_phone}</td>
          <td>${cust.cust_mobile}</td>
          <td>
              <a href="custupdate?id=${cust.cust_id}">修改</a>
              <a href="custdel?id=${cust.cust_id}">删除</a>
          </td>
        </tr>
      </c:forEach>
    </table>
  </body>
</html>